<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="../templates/TemplatePrincipal.xhtml">
        <ui:define name="top">
            
        </ui:define>
        <ui:define name="content">
            <h:form>
                <p:panel header="Locação de filme">
                <h:panelGrid columns="2">
                    <h:outputLabel value="Selecionar Filmes: "/>
                    <p:selectCheckboxMenu value="#{locacaoController.selected.filme}" label="Movies" filter="true" filterFunction="Filter" filterMatchMode="startsWith" panelStyle="width:220px">
                        <f:selectItems value="#{filmeController.itemsAvailableSelectOne}" />
                    </p:selectCheckboxMenu>
 
                    <p:dialog header="Selected Movies" modal="true" showEffect="fade" hideEffect="fade" widgetVar="dlg" resizable="false">
                        <p:dataList id="display" value="#{locacaoController.selected.filme}" var="movie">
                            #{movie}
                        </p:dataList>
                    </p:dialog>
                    <h:outputLabel value="Cliente: " for="clienteIdPessoa" />
                    <h:selectOneMenu id="clienteIdPessoa" value="#{locacaoController.selected.clienteIdPessoa}" title="pessoa" required="true" requiredMessage="Campo cliente é obrigatório">
                        <f:selectItems value="#{clienteController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="Data entrega"/>
                    <h:inputText value="#{locacaoController.selected.data}">
                        <f:convertDateTime pattern="dd/MM/yyyy"/>
                    </h:inputText>
                    
                   
                </h:panelGrid>
                <br />
                <h:commandButton action="#{locacaoController.create}" value="Concluir Locação" />
                </p:panel>
            </h:form>
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
        </ui:define>
        
        <ui:define name="bottom">
            
        </ui:define>
    </ui:composition>

</html>
